package la.bbs558.controller.user;

import cn.dev33.satoken.annotation.SaIgnore;
import la.bbs558.aop.valid.Check;
import la.bbs558.aop.valid.Valid;
import la.bbs558.controller.base.Result;
import la.bbs558.entity.AdContent;
import la.bbs558.entity.params.AdContentSearchPage;
import la.bbs558.service.AdContentService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/ad")
@RequiredArgsConstructor
@Check
public class AdContentController {

    private final AdContentService adContentService;

    @GetMapping("getAds")
    @SaIgnore
    public Result<List<AdContent>> getAdsByPosition(@Valid AdContentSearchPage search) {
        return Result.success(adContentService.getAdsByPosition(search.getPosition(), search.getBoardId()));
    };
}
